package org.jseda.queue;

import org.jseda.thread.ManagedThreadTarget;

public class MockQueueConsumer<T> implements ManagedThreadTarget
{
  private Queue<T> _queue = null;
  private int _retrievedUnits = 0;

  public MockQueueConsumer(Queue<T> queue)
  {
    _queue = queue;
  }

  public void executeLoopBody()
  {
    if (null != _queue.popFront())
      ++_retrievedUnits;
  }

  public int getRetrievedUnits()
  {
    return _retrievedUnits;
  }
}
